package com.pc.admin.scheduled;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ScheduledTask {

    @Autowired
    private WebSocketServer webSocketServer;

//    @Scheduled(cron = "0/5 * * * * ?")
    public void execute() {
        String notification = "现在是：" + System.currentTimeMillis() / 1000 + "秒，请执行前端程序";
        webSocketServer.sendNotification(notification);
        log.info(notification);
    }
}
